from rest_framework.pagination import LimitOffsetPagination
from rest_framework.response import Response

# 数据 分页器
class DataLimitOffsetPagination(LimitOffsetPagination):
    default_limit = 10 # 默认切割数据数
    max_limit = 50 #设置最大切割数
    limit_query_param = "limit"
    offset_query_param = "offset"

    def get_offset(self, request):
        return 0

    def get_paginated_response(self, data):
        return Response(data)